﻿@model 주제TreeModel
@{
    CssLink.Add("~/Content/css/treeView.css");    
}

<h2>주제 목록</h2>
<hr />

<script src="~/Content/treeview/jquery.treeview.js" type="text/javascript"></script>
<link href="~/Content/treeview/jquery.treeview.css" rel="stylesheet" media="screen">

<div class="controls pull-right" style="margin-bottom: 5px;">
    <a href="/Search/TreeView" class="btn btn-small">새로고침</a>
</div>

<div class="treeview">
    <ul id="black" class="treeview-gray">
        <li>
            @주제출력(Model)
        </li>
    </ul>
</div>

@helper 주제출력(주제TreeModel 주제) { 
    <a href="@Url.SubjectDetail(주제.ID)" class="btn btn-small btn-info">@주제.제목</a> 
    <span style="color:gray; margin-left:10px;">
        (글 수:@주제.글수, 수정일: @주제.수정일.ToString("yyyy-MM-dd"))

    </span>
    if (주제.하위주제.Count <= 0) { return; }
    <ul>
        @foreach (var n in 주제.하위주제) { 
            <li>
                @주제출력(n)
            </li>
        }
    </ul>
} 

<script type="text/javascript">
	$(document).ready(function(){
	    $("#black").treeview();
	});
</script>
